{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Line Chart with Layered Aggregates\n",
    "----------------------------------\n",
    "This example shows how to make a multi series line chart of the daily closing\n",
    "stock prices for AAPL, AMZN, GOOG, IBM, and MSFT between 2000 and 2010, along\n",
    "with a layered rule showing the average values.\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "\n",
    "import altair as alt\n",
    "alt.data_transformers.enable('json')\n",
    "from vega_datasets import data\n",
    "\n",
    "stocks = data.stocks()\n",
    "\n",
    "line = alt.Chart(stocks).mark_line().encode(\n",
    "    x='date',\n",
    "    y='price',\n",
    "    color='symbol'\n",
    ").properties(\n",
    "    width=600,\n",
    "    title=\"Daily closing prices with their aggregate prices\"\n",
    ").interactive(bind_y=False)\n",
    "\n",
    "rule = alt.Chart(stocks).mark_rule().encode(\n",
    "    alt.Y('average(price)'),\n",
    "    color='symbol',\n",
    "    size=alt.value(2)\n",
    ")\n",
    "\n",
    "line + rule\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "env": {},
   "interrupt_mode": "signal",
   "language": "python",
   "metadata": {},
   "name": "python3"
  },
  "language": "python"
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
